package com.htgd.gardenexpo.service.impl;

import com.htgd.gardenexpo.entity.GeConImpressionAccess;
import com.htgd.gardenexpo.dao.GeConImpressionAccessDao;
import com.htgd.gardenexpo.service.GeConImpressionAccessService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (GeConImpressionAccess)表服务实现类
 *
 * @author makejava
 * @since 2022-02-21 17:02:43
 */
@Service("geConImpressionAccessService")
public class GeConImpressionAccessServiceImpl implements GeConImpressionAccessService {
    @Resource
    private GeConImpressionAccessDao geConImpressionAccessDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public GeConImpressionAccess queryById(Integer id) {
        return this.geConImpressionAccessDao.queryById(id);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<GeConImpressionAccess> queryAllByLimit(int offset, int limit) {
        return this.geConImpressionAccessDao.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param geConImpressionAccess 实例对象
     * @return 实例对象
     */
    @Override
    public GeConImpressionAccess insert(GeConImpressionAccess geConImpressionAccess) {
        this.geConImpressionAccessDao.insert(geConImpressionAccess);
        return geConImpressionAccess;
    }

    /**
     * 修改数据
     *
     * @param geConImpressionAccess 实例对象
     * @return 实例对象
     */
    @Override
    public GeConImpressionAccess update(GeConImpressionAccess geConImpressionAccess) {
        this.geConImpressionAccessDao.update(geConImpressionAccess);
        return this.queryById(geConImpressionAccess.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer id) {
        return this.geConImpressionAccessDao.deleteById(id) > 0;
    }
}
